package com.hongning.railway.ui.main.fragments.home.itemviewmodel;

import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.hongning.railway.entity.MineItemBean;
import com.hongning.railway.entity.reqbean.ThreesessionSanDoneLessonBean;
import com.hongning.railway.entity.resbean.ResNewsBean;
import com.hongning.railway.ui.categorylistnews.NewDetailFragment;
import com.hongning.railway.ui.main.fragments.threesessionsandonelesson.ThreesessionSanDoneLessonFragmentInfo;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class ThreesessionSanDoneLessonItemViewModel extends ItemViewModel<BaseViewModel> {
    public ObservableField<ThreesessionSanDoneLessonBean.DataBean> dataBeans= new ObservableField<>();
    public ObservableInt colorId= new ObservableInt();
    public BindingCommand onItemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putSerializable("ThreesessionSanDoneLessonBean",dataBeans.get());
            viewModel.startContainerActivity(ThreesessionSanDoneLessonFragmentInfo.class.getCanonicalName(),bundle);
        }
    });
    public ThreesessionSanDoneLessonItemViewModel(@NonNull BaseViewModel viewModel, ThreesessionSanDoneLessonBean.DataBean dataBean) {
        super(viewModel);
        dataBeans.set(dataBean);
        colorId.set(dataBean.getSigncolumn().equals("进行中")? Color.parseColor("#ff52C41A"):(dataBean.getSigncolumn().equals("未开始")? Color.parseColor("#ffC7301F"):Color.parseColor("#ff999999")));
    }
}
